import request from '@/utils/request'
import type { addGoods } from '@/config/goods'
// 商品列表
export const goodsListApi = (page:number,tab:string,title?:string,category_id?:number) => request.get(`goods/${page}?tab=${tab}`,{params:{title,category_id}})

// 增加商品

export const addGoodsApi = (data:addGoods) => request.post(`goods`,{...data})

// 修改商品
export const updataGoodsApi = (id:number,data:addGoods) => request.post(`goods/${id}`,{...data})

// 批量上架/下架商品
export const changeStatusApi = (ids:any,status:number) => request.post(`goods/changestatus`,{ids,status})

// 批量删除
export const batchDeleteApi = (ids:any) => request.post(`goods/delete_all`,{ids})

// 批量恢复商品
export const batchResumeApi = (ids:any) => request.post(`goods/restore`,{ids})

// 彻底删除商品
export const removeDeleteApi = (ids:any) => request.post('goods/destroy',{ids})

// 设置轮播图
export const setBannerApi = (id:number,banners:any) => request.post(`goods/banners/${id}`,{banners})